/**
 * @file Thread.h
 * @author your name (you@domain.com)
 * @brief
 * @version 0.1
 * @date 2022-04-05
 *
 * @copyright Copyright (c) 2022
 *
 */

#pragma once

#include "Noncopyable.h"
#include <functional>
#include <pthread.h>

namespace wd
{
class Thread : Noncopyable
{
  public:
    typedef std::function<void()> ThreadCallback;
    Thread(ThreadCallback cb);
    ~Thread();

    void start();
    void join();

    static void *threadFunc(void *arg);

  private:
    pthread_t pthId_;
    bool isRunning_;
    ThreadCallback cb_;
};
} // end of namespace wd
